<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录成功</title>
    <body>
    <script>
function check()
    {
      var username=sessionStorage.key(sessionStorage.length);
         if(sessionStorage.length==0)
     {
       alert("非法访问！");
         
      window.location.href='http://zhuguangqi.gitee.io/buptsice_training_2017_2/denglu.html'
    
       
     }


           else { var list = document.getElementById("okname"); 
               list.innerHTML =sessionStorage.getItem("username");
         loadAll();
       }
    }


        function loadAll(){  
        var list = document.getElementById("list");  
        if(localStorage.length>0){  
            var result = "<table border='1'>";  
            result += "<tr><td>用户名</td><td>密码</td><td>邮箱</td><td>注册时间</td></tr>";  
            for(var i=0;i<localStorage.length;i++)
      {  
                var sitename = localStorage.key(i);  
                var str = localStorage.getItem(sitename); 
        var site = JSON.parse(str);
                result += "<tr><td>"+sitename+"</td><td>"+site.siteurl+"</td><td>"+site.sitename+"</td><td>"+site.nowtime+"</td></tr>";  
            }  
            result += "</table>";  
            list.innerHTML = result;  
        }else{  
            list.innerHTML = "数据为空……";  
        }  
    }      
    </script>

</head>

<div class="container container-small">
	<h1>登录成功</h1>	
		
	<hr/>
</div>


  &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 
  <font size="6" color="red"><b id="okname"> </b> </font>
  &nbsp;&nbsp;
  <font size="3"> 你好~ </font>
  <div id="list"> </div>
  <script>check()</script>
  <a href="http://zhuguangqi.gitee.io/buptsice_training_2017_2/denglu.html">注销</a>
	
</body>
</html>